<?php
class rekRekom extends CI_Controller {

	function __construct()
	{
		parent::__construct();
		$this->load->model('mrekap');
		$this->load->model('msurat');
		$this->load->model('mpenandatangan');
	}
	
	function index()
	{
		 $token = $this->session->userdata('token');
		 $pengajuan = "2"; // 1=skck 2=rekomendasi
		 if($token){
			$sektor = $this->session->userdata('sektor');
			$data['results'] = $this->mrekap->getList($sektor,$pengajuan);
			$this->load->view('rekRekom/list',$data);
		 }else{
			redirect('login');
		 }
	}
	
	function detailData($month,$year)
	{
		$sektor = $this->session->userdata('sektor');
		$pengajuan = "2"; // 1=skck 2=rekomendasi
		
		$data['getTgl'] = $this->mrekap->getTglDetail($month,$year,$sektor,$pengajuan);
		$data['results'] = $this->mrekap->getDetail($month,$year,$sektor,$pengajuan);
		$this->load->view('rekRekom/detail',$data);
	}	
	
	function printData($month,$year)
	{
		$sektor = $this->session->userdata('sektor');
		$posisi_kiri="1";
		$posisi_kanan="2";
		$pengajuan = "2"; // 1=skck 2=rekomendasi
		
		$data['results'] = $this->mrekap->getDetail($month,$year,$sektor,$pengajuan);
		$data['surat'] = $this->msurat->getDetSektor($sektor);
		$data['penandatangan_kiri'] = $this->mpenandatangan->getdatasurat($sektor,$posisi_kiri,"1");
		$data['penandatangan_kanan'] = $this->mpenandatangan->getdatasurat($sektor,$posisi_kanan,"1");
		$this->load->view('rekRekom/print',$data);
	}
}
?>